<!DOCTYPE html>

<html xmlns="http://www.w3.org/1999/xhtml">

<head>

<meta charset="utf-8">
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta name="generator" content="pandoc" />


<meta name="author" content="Yiying Wang" />

<meta name="date" content="2017-03-15" />

<title>Basic Plots 21 - WordCloud</title>

<script src="libs/jquery-1.11.3/jquery.min.js"></script>
<meta name="viewport" content="width=device-width, initial-scale=1" />
<link href="libs/bootstrap-3.3.5/css/cosmo.min.css" rel="stylesheet" />
<script src="libs/bootstrap-3.3.5/js/bootstrap.min.js"></script>
<script src="libs/bootstrap-3.3.5/shim/html5shiv.min.js"></script>
<script src="libs/bootstrap-3.3.5/shim/respond.min.js"></script>
<script src="libs/navigation-1.1/tabsets.js"></script>
<script src="libs/htmlwidgets-0.8/htmlwidgets.js"></script>
<script src="libs/echarts-2.2.7/echarts-all.js"></script>
<script src="libs/charts-ext-2.2.7/main.js"></script>
<script src="libs/charts-ext-2.2.7/BMap.js"></script>
<script src="libs/echarts-binding-0.2/echarts.js"></script>


<style type="text/css">code{white-space: pre;}</style>
<style type="text/css">
div.sourceCode { overflow-x: auto; }
table.sourceCode, tr.sourceCode, td.lineNumbers, td.sourceCode {
  margin: 0; padding: 0; vertical-align: baseline; border: none; }
table.sourceCode { width: 100%; line-height: 100%; }
td.lineNumbers { text-align: right; padding-right: 4px; padding-left: 4px; color: #aaaaaa; border-right: 1px solid #aaaaaa; }
td.sourceCode { padding-left: 5px; }
code > span.kw { color: #007020; font-weight: bold; } /* Keyword */
code > span.dt { color: #902000; } /* DataType */
code > span.dv { color: #40a070; } /* DecVal */
code > span.bn { color: #40a070; } /* BaseN */
code > span.fl { color: #40a070; } /* Float */
code > span.ch { color: #4070a0; } /* Char */
code > span.st { color: #4070a0; } /* String */
code > span.co { color: #60a0b0; font-style: italic; } /* Comment */
code > span.ot { color: #007020; } /* Other */
code > span.al { color: #ff0000; font-weight: bold; } /* Alert */
code > span.fu { color: #06287e; } /* Function */
code > span.er { color: #ff0000; font-weight: bold; } /* Error */
code > span.wa { color: #60a0b0; font-weight: bold; font-style: italic; } /* Warning */
code > span.cn { color: #880000; } /* Constant */
code > span.sc { color: #4070a0; } /* SpecialChar */
code > span.vs { color: #4070a0; } /* VerbatimString */
code > span.ss { color: #bb6688; } /* SpecialString */
code > span.im { } /* Import */
code > span.va { color: #19177c; } /* Variable */
code > span.cf { color: #007020; font-weight: bold; } /* ControlFlow */
code > span.op { color: #666666; } /* Operator */
code > span.bu { } /* BuiltIn */
code > span.ex { } /* Extension */
code > span.pp { color: #bc7a00; } /* Preprocessor */
code > span.at { color: #7d9029; } /* Attribute */
code > span.do { color: #ba2121; font-style: italic; } /* Documentation */
code > span.an { color: #60a0b0; font-weight: bold; font-style: italic; } /* Annotation */
code > span.cv { color: #60a0b0; font-weight: bold; font-style: italic; } /* CommentVar */
code > span.in { color: #60a0b0; font-weight: bold; font-style: italic; } /* Information */
</style>
<style type="text/css">
  pre:not([class]) {
    background-color: white;
  }
</style>


<style type="text/css">
h1 {
  font-size: 34px;
}
h1.title {
  font-size: 38px;
}
h2 {
  font-size: 30px;
}
h3 {
  font-size: 24px;
}
h4 {
  font-size: 18px;
}
h5 {
  font-size: 16px;
}
h6 {
  font-size: 12px;
}
.table th:not([align]) {
  text-align: left;
}
</style>

<link rel="stylesheet" href="/home/madlogos/R/x86_64-pc-linux-gnu-library/3.3/knitr/misc/vignette.css" type="text/css" />

</head>

<body>

<style type = "text/css">
.main-container {
  max-width: 940px;
  margin-left: auto;
  margin-right: auto;
}
code {
  color: inherit;
  background-color: rgba(0, 0, 0, 0.04);
}
img {
  max-width:100%;
  height: auto;
}
.tabbed-pane {
  padding-top: 12px;
}
button.code-folding-btn:focus {
  outline: none;
}
</style>



<div class="container-fluid main-container">

<!-- tabsets -->
<script>
$(document).ready(function () {
  window.buildTabsets("TOC");
});
</script>

<!-- code folding -->






<div class="fluid-row" id="header">



<h1 class="title toc-ignore">Basic Plots 21 - WordCloud</h1>
<h4 class="author"><em>Yiying Wang</em></h4>
<h4 class="date"><em>2017-03-15</em></h4>

</div>

<div id="TOC">
<ul>
<li><a href="#introduction"><span class="toc-section-number">1</span> Introduction</a></li>
<li><a href="#function-call"><span class="toc-section-number">2</span> Function Call</a></li>
<li><a href="#showcase"><span class="toc-section-number">3</span> Showcase</a><ul>
<li><a href="#data-preparation"><span class="toc-section-number">3.1</span> Data Preparation</a></li>
<li><a href="#basic-plot"><span class="toc-section-number">3.2</span> Basic Plot</a></li>
<li><a href="#color-by-series"><span class="toc-section-number">3.3</span> Color by Series</a></li>
<li><a href="#with-timeline"><span class="toc-section-number">3.4</span> With Timeline</a></li>
</ul></li>
<li><a href="#futher-setup"><span class="toc-section-number">4</span> Futher Setup</a><ul>
<li><a href="#settheme"><span class="toc-section-number">4.1</span> <code>setTheme</code></a></li>
</ul></li>
</ul>
</div>

<p>First, you should load <code>recharts</code>:</p>
<div class="sourceCode"><pre class="sourceCode r"><code class="sourceCode r"><span class="kw">library</span>(recharts)</code></pre></div>
<div id="introduction" class="section level1">
<h1><span class="header-section-number">1</span> Introduction</h1>
<p>WordCloud has only 1 type: wordCloud</p>
<table id='intro'>
<tr>
<td>
<div id="htmlwidget-4980b50319a2c49d773c" style="width:400px;height:300px;" class="echarts html-widget"></div>
<script type="application/json" data-for="htmlwidget-4980b50319a2c49d773c">{"x":{"series":[{"data":[{"name":"不老男神费翔发福","value":41493,"itemStyle":{"normal":{"color":"#cd5c5c"}}},{"name":"沈梦辰揭澡戏内幕","value":105433,"itemStyle":{"normal":{"color":"#30e0e0"}}},{"name":"吃牛排长五米虫子","value":102738,"itemStyle":{"normal":{"color":"#ffd700"}}},{"name":"刀砍老师后被群殴","value":5732,"itemStyle":{"normal":{"color":"#ff69b4"}}},{"name":"道路最牛钉子树","value":411727,"itemStyle":{"normal":{"color":"#ffd700"}}},{"name":"赌王儿子坐经济舱","value":6274,"itemStyle":{"normal":{"color":"#da70d6"}}},{"name":"范冰冰半夜看剧本","value":4661,"itemStyle":{"normal":{"color":"#da70d6"}}},{"name":"记者暗访外卖餐馆","value":22341,"itemStyle":{"normal":{"color":"#ffd700"}}},{"name":"扩建鱼塘挖出古墓","value":5170,"itemStyle":{"normal":{"color":"#32cd32"}}},{"name":"李小璐喊话曹云金","value":6739,"itemStyle":{"normal":{"color":"#3cb371"}}},{"name":"联合打击瘦脸针","value":26150,"itemStyle":{"normal":{"color":"#32cd32"}}},{"name":"刘诗诗推助理行李","value":43648,"itemStyle":{"normal":{"color":"#6495ed"}}},{"name":"刘涛十年前照曝光","value":10862,"itemStyle":{"normal":{"color":"#ff69b4"}}},{"name":"马云进军美遇对手","value":15534,"itemStyle":{"normal":{"color":"#32cd32"}}},{"name":"母亲怒砸玛莎拉蒂","value":16104,"itemStyle":{"normal":{"color":"#7b68ee"}}},{"name":"母亲女儿同怀二胎","value":267299,"itemStyle":{"normal":{"color":"#da70d6"}}},{"name":"男星载女友遇车祸","value":29343,"itemStyle":{"normal":{"color":"#cd5c5c"}}},{"name":"男子购买陨石求婚","value":6979,"itemStyle":{"normal":{"color":"#3cb371"}}},{"name":"倪萍感谢苦难","value":7982,"itemStyle":{"normal":{"color":"#32cd32"}}},{"name":"曝俏江南黑厨内幕","value":7296,"itemStyle":{"normal":{"color":"#87cefa"}}},{"name":"情书有求婚藏头诗","value":8830,"itemStyle":{"normal":{"color":"#32cd32"}}},{"name":"王宝强称做人忠诚","value":17171,"itemStyle":{"normal":{"color":"#ff69b4"}}},{"name":"洗澡搓破痣竟成癌","value":4967,"itemStyle":{"normal":{"color":"#ff7f50"}}},{"name":"小燕子替身是男生","value":7852,"itemStyle":{"normal":{"color":"#ffd700"}}},{"name":"徐静蕾冻卵会上瘾","value":15678,"itemStyle":{"normal":{"color":"#00fa9a"}}},{"name":"姚明代言成被告","value":12500,"itemStyle":{"normal":{"color":"#ff69b4"}}},{"name":"英国出现新毒品","value":8683,"itemStyle":{"normal":{"color":"#7b68ee"}}},{"name":"又一个小杨幂出道","value":67011,"itemStyle":{"normal":{"color":"#ffa500"}}},{"name":"醉酒撞停放车身亡","value":35571,"itemStyle":{"normal":{"color":"#40e0d0"}}},{"name":"mobileye被收购","value":5464,"itemStyle":{"normal":{"color":"#7b68ee"}}}],"textRotation":[0,-45,-90,45,90],"type":"wordCloud","size":["80%","80%"]}],"xAxis":[{"type":"category","show":false,"position":"bottom","name":"","nameLocation":"end","boundaryGap":[0,0],"scale":true,"axisLine":{"show":true,"onZero":false},"axisTick":{"show":false},"axisLabel":{"show":true},"splitLine":{"show":true},"splitArea":{"show":false},"data":["道路最牛钉子树","母亲女儿同怀二胎","沈梦辰揭澡戏内幕","吃牛排长五米虫子","又一个小杨幂出道","刘诗诗推助理行李","不老男神费翔发福","醉酒撞停放车身亡","男星载女友遇车祸","联合打击瘦脸针","记者暗访外卖餐馆","王宝强称做人忠诚","母亲怒砸玛莎拉蒂","徐静蕾冻卵会上瘾","马云进军美遇对手","姚明代言成被告","刘涛十年前照曝光","情书有求婚藏头诗","英国出现新毒品","倪萍感谢苦难","小燕子替身是男生","曝俏江南黑厨内幕","男子购买陨石求婚","李小璐喊话曹云金","赌王儿子坐经济舱","刀砍老师后被群殴","mobileye被收购","扩建鱼塘挖出古墓","洗澡搓破痣竟成癌","范冰冰半夜看剧本"]}],"yAxis":[{"type":"value","show":false,"position":"left","name":"","nameLocation":"end","boundaryGap":[0,0],"scale":true,"axisLine":{"show":true,"onZero":false},"axisTick":{"show":false},"axisLabel":{"show":true},"splitLine":{"show":true},"splitArea":{"show":false}}],"grid":{"borderWidth":0},"tooltip":{"show":true,"trigger":"axis","axisPointer":{"type":"none","crossStyle":{"type":"dashed"},"lineStyle":{"type":"solid","width":1},"shadowStyle":{"color":"rgba(150,150,150,0.3)","width":"auto","type":"default"}},"textStyle":{"color":"#fff"},"islandFormatter":"{a} < br/>{b} : {c}","enterable":false,"showDelay":20,"hideDelay":100,"transitionDuration":0.4,"backgroundColor":"rgba(0,0,0,0.7)","borderColor":"#333","borderWidth":0,"borderRadius":4},"toolbox":{"show":true,"feature":{"mark":{"show":true},"dataZoom":{"show":true},"dataView":{"show":true,"readOnly":false},"magicType":{"show":false},"restore":{"show":true},"saveAsImage":{"show":true}},"x":"right","y":"top","orient":"horizontal"},"legend":{"show":true,"data":[],"x":"left","y":"top","orient":"horizontal"},"theme":"infographic"},"evals":[],"jsHooks":[]}</script>
</td>
<td>
</table>
<p>The keys are:</p>
<ul>
<li>character <code>x</code> represents the words</li>
<li>numeric <code>y</code> represents the frequency of the words</li>
<li><code>series</code> is not linked with legend, but linked with colors</li>
</ul>
</div>
<div id="function-call" class="section level1">
<h1><span class="header-section-number">2</span> Function Call</h1>
<div class="sourceCode"><pre class="sourceCode r"><code class="sourceCode r"><span class="kw">echartr</span>(data, x, y, &lt;t&gt;, &lt;type&gt;)</code></pre></div>
<table>
<colgroup>
<col width="11%" />
<col width="88%" />
</colgroup>
<thead>
<tr class="header">
<th>Arg</th>
<th>Requirement</th>
</tr>
</thead>
<tbody>
<tr class="odd">
<td><p><strong>data</strong></p></td>
<td><p>source data in the form of data.frame</p></td>
</tr>
<tr class="even">
<td><p><strong>x</strong></p></td>
<td><p>character independent variable. Only the first one is accepted if multiple variables are provided.</p></td>
</tr>
<tr class="odd">
<td><p><strong>y</strong></p></td>
<td><p>numeric dependent variable. Only the first one is accepted.</p></td>
</tr>
<tr class="even">
<td><p>series</p></td>
<td><p>data series variable which will be coerced to factors. Only the first one is accepted if multiple variables are provided.</p></td>
</tr>
<tr class="odd">
<td><p>t</p></td>
<td><p>timeline variable which will be coerced to factors. Only the first one is accepted if multiple variables are provided.</p></td>
</tr>
<tr class="even">
<td><p>type</p></td>
<td><p>‘wordCloud’</p></td>
</tr>
</tbody>
</table>
</div>
<div id="showcase" class="section level1">
<h1><span class="header-section-number">3</span> Showcase</h1>
<div id="data-preparation" class="section level2">
<h2><span class="header-section-number">3.1</span> Data Preparation</h2>
<p>Fetch the Baidu buzz hotword web page and parse it into a data.frame Keyword and Freq.</p>
<p>For this purpose, we composed a function <code>getBaiduHot</code> to parse the <em>Baidu Hot Word Trend</em> web page.</p>
<div class="sourceCode"><pre class="sourceCode r"><code class="sourceCode r">getBaiduHot &lt;-<span class="st"> </span>function(url, <span class="dt">top=</span><span class="dv">30</span>, <span class="dt">HTMLencoding=</span><span class="ot">NULL</span>){
    baiduhot &lt;-<span class="st"> </span><span class="kw">paste0</span>(<span class="kw">readLines</span>(url), <span class="dt">collapse=</span><span class="st">&quot;&quot;</span>)
    charset &lt;-<span class="st"> </span><span class="kw">gsub</span>(<span class="st">&#39;^.+charset=([[:alnum:]-]+?)[^[:alnum:]-].+$&#39;</span>, <span class="st">&quot;</span><span class="ch">\\</span><span class="st">1&quot;</span>, baiduhot)
    if (<span class="kw">is.null</span>(HTMLencoding)) if (!<span class="kw">is.null</span>(charset)) HTMLencoding &lt;-<span class="st"> </span>charset
    baiduhot &lt;-<span class="st"> </span>stringr::<span class="kw">str_conv</span>(baiduhot, HTMLencoding)
    hotword &lt;-<span class="st"> </span><span class="kw">gsub</span>(<span class="st">&quot;.+?&lt;a class=</span><span class="ch">\&quot;</span><span class="st">list-title</span><span class="ch">\&quot;</span><span class="st">[^&gt;]+?&gt;([^&lt;&gt;]+?)&lt;/a&gt;.+?&lt;span class=</span><span class="ch">\&quot;</span><span class="st">icon-(rise|fair|fall)</span><span class="ch">\&quot;</span><span class="st">&gt;(</span><span class="ch">\\</span><span class="st">d+?)&lt;/span&gt;.+?&quot;</span>,<span class="st">&quot;</span><span class="ch">\\</span><span class="st">1</span><span class="ch">\t\\</span><span class="st">3</span><span class="ch">\t\\</span><span class="st">2</span><span class="ch">\t</span><span class="st">&quot;</span>, baiduhot)
    hotword &lt;-<span class="st"> </span><span class="kw">enc2native</span>(<span class="kw">gsub</span>(<span class="st">&quot;^(.+?)</span><span class="ch">\t</span><span class="st">{4,}.+$&quot;</span>,<span class="st">&quot;</span><span class="ch">\\</span><span class="st">1&quot;</span>,hotword))
    hotword &lt;-<span class="st"> </span><span class="kw">t</span>(<span class="kw">matrix</span>(<span class="kw">unlist</span>(<span class="kw">strsplit</span>(hotword,<span class="st">&quot;</span><span class="ch">\t</span><span class="st">&quot;</span>)), <span class="dt">nrow=</span><span class="dv">3</span>))
    hotword &lt;-<span class="st"> </span><span class="kw">as.data.frame</span>(hotword, <span class="dt">stringsAsFactors=</span><span class="ot">FALSE</span>)
    <span class="kw">names</span>(hotword) &lt;-<span class="st"> </span><span class="kw">c</span>(<span class="st">&quot;Keyword&quot;</span>, <span class="st">&quot;Freq&quot;</span>, <span class="st">&quot;Trend&quot;</span>)
    hotword$Freq &lt;-<span class="st"> </span><span class="kw">as.numeric</span>(hotword$Freq)
    hotword &lt;-<span class="st"> </span>hotword[<span class="kw">order</span>(hotword$Freq, <span class="dt">decreasing=</span><span class="ot">TRUE</span>),]
    <span class="kw">return</span>(hotword[<span class="dv">1</span>:top,])
}
hotword &lt;-<span class="st"> </span><span class="kw">getBaiduHot</span>(<span class="st">&quot;http://top.baidu.com/buzz?b=1&quot;</span>, <span class="dt">HTMLencoding =</span> <span class="st">&#39;GBK&#39;</span>)
knitr::<span class="kw">kable</span>(hotword)</code></pre></div>
<table>
<thead>
<tr class="header">
<th></th>
<th align="left">Keyword</th>
<th align="right">Freq</th>
<th align="left">Trend</th>
</tr>
</thead>
<tbody>
<tr class="odd">
<td>6</td>
<td align="left">道路最牛钉子树</td>
<td align="right">411727</td>
<td align="left">rise</td>
</tr>
<tr class="even">
<td>1</td>
<td align="left">母亲女儿同怀二胎</td>
<td align="right">267299</td>
<td align="left">rise</td>
</tr>
<tr class="odd">
<td>5</td>
<td align="left">沈梦辰揭澡戏内幕</td>
<td align="right">105433</td>
<td align="left">fall</td>
</tr>
<tr class="even">
<td>9</td>
<td align="left">吃牛排长五米虫子</td>
<td align="right">102738</td>
<td align="left">rise</td>
</tr>
<tr class="odd">
<td>11</td>
<td align="left">又一个小杨幂出道</td>
<td align="right">67011</td>
<td align="left">fall</td>
</tr>
<tr class="even">
<td>10</td>
<td align="left">刘诗诗推助理行李</td>
<td align="right">43648</td>
<td align="left">rise</td>
</tr>
<tr class="odd">
<td>3</td>
<td align="left">不老男神费翔发福</td>
<td align="right">41493</td>
<td align="left">fall</td>
</tr>
<tr class="even">
<td>4</td>
<td align="left">醉酒撞停放车身亡</td>
<td align="right">35571</td>
<td align="left">fall</td>
</tr>
<tr class="odd">
<td>8</td>
<td align="left">男星载女友遇车祸</td>
<td align="right">29343</td>
<td align="left">fall</td>
</tr>
<tr class="even">
<td>2</td>
<td align="left">联合打击瘦脸针</td>
<td align="right">26150</td>
<td align="left">rise</td>
</tr>
<tr class="odd">
<td>13</td>
<td align="left">记者暗访外卖餐馆</td>
<td align="right">22341</td>
<td align="left">fall</td>
</tr>
<tr class="even">
<td>7</td>
<td align="left">王宝强称做人忠诚</td>
<td align="right">17171</td>
<td align="left">rise</td>
</tr>
<tr class="odd">
<td>15</td>
<td align="left">母亲怒砸玛莎拉蒂</td>
<td align="right">16104</td>
<td align="left">fall</td>
</tr>
<tr class="even">
<td>18</td>
<td align="left">徐静蕾冻卵会上瘾</td>
<td align="right">15678</td>
<td align="left">fall</td>
</tr>
<tr class="odd">
<td>17</td>
<td align="left">马云进军美遇对手</td>
<td align="right">15534</td>
<td align="left">fall</td>
</tr>
<tr class="even">
<td>14</td>
<td align="left">姚明代言成被告</td>
<td align="right">12500</td>
<td align="left">fall</td>
</tr>
<tr class="odd">
<td>19</td>
<td align="left">刘涛十年前照曝光</td>
<td align="right">10862</td>
<td align="left">fall</td>
</tr>
<tr class="even">
<td>20</td>
<td align="left">情书有求婚藏头诗</td>
<td align="right">8830</td>
<td align="left">fair</td>
</tr>
<tr class="odd">
<td>31</td>
<td align="left">英国出现新毒品</td>
<td align="right">8683</td>
<td align="left">fall</td>
</tr>
<tr class="even">
<td>50</td>
<td align="left">倪萍感谢苦难</td>
<td align="right">7982</td>
<td align="left">rise</td>
</tr>
<tr class="odd">
<td>22</td>
<td align="left">小燕子替身是男生</td>
<td align="right">7852</td>
<td align="left">fall</td>
</tr>
<tr class="even">
<td>34</td>
<td align="left">曝俏江南黑厨内幕</td>
<td align="right">7296</td>
<td align="left">rise</td>
</tr>
<tr class="odd">
<td>32</td>
<td align="left">男子购买陨石求婚</td>
<td align="right">6979</td>
<td align="left">rise</td>
</tr>
<tr class="even">
<td>21</td>
<td align="left">李小璐喊话曹云金</td>
<td align="right">6739</td>
<td align="left">fall</td>
</tr>
<tr class="odd">
<td>30</td>
<td align="left">赌王儿子坐经济舱</td>
<td align="right">6274</td>
<td align="left">fall</td>
</tr>
<tr class="even">
<td>27</td>
<td align="left">刀砍老师后被群殴</td>
<td align="right">5732</td>
<td align="left">fall</td>
</tr>
<tr class="odd">
<td>16</td>
<td align="left">mobileye被收购</td>
<td align="right">5464</td>
<td align="left">fall</td>
</tr>
<tr class="even">
<td>25</td>
<td align="left">扩建鱼塘挖出古墓</td>
<td align="right">5170</td>
<td align="left">rise</td>
</tr>
<tr class="odd">
<td>38</td>
<td align="left">洗澡搓破痣竟成癌</td>
<td align="right">4967</td>
<td align="left">rise</td>
</tr>
<tr class="even">
<td>29</td>
<td align="left">范冰冰半夜看剧本</td>
<td align="right">4661</td>
<td align="left">rise</td>
</tr>
</tbody>
</table>
</div>
<div id="basic-plot" class="section level2">
<h2><span class="header-section-number">3.2</span> Basic Plot</h2>
<p>Only provide <code>x</code> and <code>y</code>.</p>
<div class="sourceCode"><pre class="sourceCode r"><code class="sourceCode r"><span class="kw">echartr</span>(hotword, Keyword, Freq, <span class="dt">type=</span><span class="st">&#39;wordCloud&#39;</span>) %&gt;%<span class="st"> </span>
<span class="st">    </span><span class="kw">setTitle</span>(<span class="st">&#39;Baidu Hot Word Top30 (realtime)&#39;</span>, <span class="kw">as.character</span>(<span class="kw">Sys.time</span>()))</code></pre></div>
<div id="htmlwidget-9a5476c3214a273b77de" style="width:672px;height:480px;" class="echarts html-widget"></div>
<script type="application/json" data-for="htmlwidget-9a5476c3214a273b77de">{"x":{"series":[{"data":[{"name":"不老男神费翔发福","value":41493,"itemStyle":{"normal":{"color":"#ba55d3"}}},{"name":"沈梦辰揭澡戏内幕","value":105433,"itemStyle":{"normal":{"color":"#ffd700"}}},{"name":"吃牛排长五米虫子","value":102738,"itemStyle":{"normal":{"color":"#87cefa"}}},{"name":"刀砍老师后被群殴","value":5732,"itemStyle":{"normal":{"color":"#7b68ee"}}},{"name":"道路最牛钉子树","value":411727,"itemStyle":{"normal":{"color":"#ffa500"}}},{"name":"赌王儿子坐经济舱","value":6274,"itemStyle":{"normal":{"color":"#32cd32"}}},{"name":"范冰冰半夜看剧本","value":4661,"itemStyle":{"normal":{"color":"#ff69b4"}}},{"name":"记者暗访外卖餐馆","value":22341,"itemStyle":{"normal":{"color":"#32cd32"}}},{"name":"扩建鱼塘挖出古墓","value":5170,"itemStyle":{"normal":{"color":"#32cd32"}}},{"name":"李小璐喊话曹云金","value":6739,"itemStyle":{"normal":{"color":"#b8860b"}}},{"name":"联合打击瘦脸针","value":26150,"itemStyle":{"normal":{"color":"#3cb371"}}},{"name":"刘诗诗推助理行李","value":43648,"itemStyle":{"normal":{"color":"#cd5c5c"}}},{"name":"刘涛十年前照曝光","value":10862,"itemStyle":{"normal":{"color":"#ffd700"}}},{"name":"马云进军美遇对手","value":15534,"itemStyle":{"normal":{"color":"#ffa500"}}},{"name":"母亲怒砸玛莎拉蒂","value":16104,"itemStyle":{"normal":{"color":"#ffa500"}}},{"name":"母亲女儿同怀二胎","value":267299,"itemStyle":{"normal":{"color":"#ff6347"}}},{"name":"男星载女友遇车祸","value":29343,"itemStyle":{"normal":{"color":"#ff69b4"}}},{"name":"男子购买陨石求婚","value":6979,"itemStyle":{"normal":{"color":"#6495ed"}}},{"name":"倪萍感谢苦难","value":7982,"itemStyle":{"normal":{"color":"#da70d6"}}},{"name":"曝俏江南黑厨内幕","value":7296,"itemStyle":{"normal":{"color":"#ff6347"}}},{"name":"情书有求婚藏头诗","value":8830,"itemStyle":{"normal":{"color":"#ff00ff"}}},{"name":"王宝强称做人忠诚","value":17171,"itemStyle":{"normal":{"color":"#ff69b4"}}},{"name":"洗澡搓破痣竟成癌","value":4967,"itemStyle":{"normal":{"color":"#ff6347"}}},{"name":"小燕子替身是男生","value":7852,"itemStyle":{"normal":{"color":"#ffa500"}}},{"name":"徐静蕾冻卵会上瘾","value":15678,"itemStyle":{"normal":{"color":"#3cb371"}}},{"name":"姚明代言成被告","value":12500,"itemStyle":{"normal":{"color":"#b8860b"}}},{"name":"英国出现新毒品","value":8683,"itemStyle":{"normal":{"color":"#6b8e23"}}},{"name":"又一个小杨幂出道","value":67011,"itemStyle":{"normal":{"color":"#6b8e23"}}},{"name":"醉酒撞停放车身亡","value":35571,"itemStyle":{"normal":{"color":"#7b68ee"}}},{"name":"mobileye被收购","value":5464,"itemStyle":{"normal":{"color":"#ff6347"}}}],"textRotation":[0,-45,-90,45,90],"type":"wordCloud","size":["80%","80%"]}],"xAxis":[{"type":"category","show":false,"position":"bottom","name":"","nameLocation":"end","boundaryGap":[0,0],"scale":true,"axisLine":{"show":true,"onZero":false},"axisTick":{"show":false},"axisLabel":{"show":true},"splitLine":{"show":true},"splitArea":{"show":false},"data":["道路最牛钉子树","母亲女儿同怀二胎","沈梦辰揭澡戏内幕","吃牛排长五米虫子","又一个小杨幂出道","刘诗诗推助理行李","不老男神费翔发福","醉酒撞停放车身亡","男星载女友遇车祸","联合打击瘦脸针","记者暗访外卖餐馆","王宝强称做人忠诚","母亲怒砸玛莎拉蒂","徐静蕾冻卵会上瘾","马云进军美遇对手","姚明代言成被告","刘涛十年前照曝光","情书有求婚藏头诗","英国出现新毒品","倪萍感谢苦难","小燕子替身是男生","曝俏江南黑厨内幕","男子购买陨石求婚","李小璐喊话曹云金","赌王儿子坐经济舱","刀砍老师后被群殴","mobileye被收购","扩建鱼塘挖出古墓","洗澡搓破痣竟成癌","范冰冰半夜看剧本"]}],"yAxis":[{"type":"value","show":false,"position":"left","name":"","nameLocation":"end","boundaryGap":[0,0],"scale":true,"axisLine":{"show":true,"onZero":false},"axisTick":{"show":false},"axisLabel":{"show":true},"splitLine":{"show":true},"splitArea":{"show":false}}],"grid":{"borderWidth":0},"tooltip":{"show":true,"trigger":"axis","axisPointer":{"type":"none","crossStyle":{"type":"dashed"},"lineStyle":{"type":"solid","width":1},"shadowStyle":{"color":"rgba(150,150,150,0.3)","width":"auto","type":"default"}},"textStyle":{"color":"#fff"},"islandFormatter":"{a} < br/>{b} : {c}","enterable":false,"showDelay":20,"hideDelay":100,"transitionDuration":0.4,"backgroundColor":"rgba(0,0,0,0.7)","borderColor":"#333","borderWidth":0,"borderRadius":4},"toolbox":{"show":true,"feature":{"mark":{"show":true},"dataZoom":{"show":true},"dataView":{"show":true,"readOnly":false},"magicType":{"show":false},"restore":{"show":true},"saveAsImage":{"show":true}},"x":"right","y":"top","orient":"horizontal"},"legend":{"show":true,"data":[],"x":"left","y":"top","orient":"horizontal"},"title":{"text":"Baidu Hot Word Top30 (realtime)","subtext":"2017-03-15 23:54:15","x":"center","y":"bottom","orient":"horizontal"}},"evals":[],"jsHooks":[]}</script>
</div>
<div id="color-by-series" class="section level2">
<h2><span class="header-section-number">3.3</span> Color by Series</h2>
<p>We want to group the hot words. Let’s assign a <code>series</code> variable ‘Trend’. The ‘rise’ series and ‘fall’ series are colored differently.</p>
<div class="sourceCode"><pre class="sourceCode r"><code class="sourceCode r"><span class="kw">echartr</span>(hotword, Keyword, Freq, Trend, <span class="dt">type=</span><span class="st">&#39;wordCloud&#39;</span>) %&gt;%<span class="st"> </span>
<span class="st">    </span><span class="kw">setTitle</span>(<span class="st">&#39;Baidu Hot Word Top30 (realtime)&#39;</span>, <span class="kw">as.character</span>(<span class="kw">Sys.time</span>()))</code></pre></div>
<div id="htmlwidget-10f51cad579a3b5d786c" style="width:672px;height:480px;" class="echarts html-widget"></div>
<script type="application/json" data-for="htmlwidget-10f51cad579a3b5d786c">{"x":{"series":[{"data":[{"name":"不老男神费翔发福","value":41493,"itemStyle":{"normal":{"color":"#da70d6"}}},{"name":"沈梦辰揭澡戏内幕","value":105433,"itemStyle":{"normal":{"color":"#da70d6"}}},{"name":"吃牛排长五米虫子","value":102738,"itemStyle":{"normal":{"color":"#87cefa"}}},{"name":"刀砍老师后被群殴","value":5732,"itemStyle":{"normal":{"color":"#da70d6"}}},{"name":"道路最牛钉子树","value":411727,"itemStyle":{"normal":{"color":"#87cefa"}}},{"name":"赌王儿子坐经济舱","value":6274,"itemStyle":{"normal":{"color":"#da70d6"}}},{"name":"范冰冰半夜看剧本","value":4661,"itemStyle":{"normal":{"color":"#87cefa"}}},{"name":"记者暗访外卖餐馆","value":22341,"itemStyle":{"normal":{"color":"#87cefa"}}},{"name":"扩建鱼塘挖出古墓","value":5170,"itemStyle":{"normal":{"color":"#87cefa"}}},{"name":"李小璐喊话曹云金","value":6739,"itemStyle":{"normal":{"color":"#da70d6"}}},{"name":"联合打击瘦脸针","value":26150,"itemStyle":{"normal":{"color":"#87cefa"}}},{"name":"刘诗诗推助理行李","value":43648,"itemStyle":{"normal":{"color":"#da70d6"}}},{"name":"刘涛十年前照曝光","value":10862,"itemStyle":{"normal":{"color":"#87cefa"}}},{"name":"马云进军美遇对手","value":15534,"itemStyle":{"normal":{"color":"#87cefa"}}},{"name":"母亲怒砸玛莎拉蒂","value":16104,"itemStyle":{"normal":{"color":"#87cefa"}}},{"name":"母亲女儿同怀二胎","value":267299,"itemStyle":{"normal":{"color":"#87cefa"}}},{"name":"男星载女友遇车祸","value":29343,"itemStyle":{"normal":{"color":"#87cefa"}}},{"name":"男子购买陨石求婚","value":6979,"itemStyle":{"normal":{"color":"#ff7f50"}}},{"name":"倪萍感谢苦难","value":7982,"itemStyle":{"normal":{"color":"#87cefa"}}},{"name":"曝俏江南黑厨内幕","value":7296,"itemStyle":{"normal":{"color":"#da70d6"}}},{"name":"情书有求婚藏头诗","value":8830,"itemStyle":{"normal":{"color":"#87cefa"}}},{"name":"王宝强称做人忠诚","value":17171,"itemStyle":{"normal":{"color":"#da70d6"}}},{"name":"洗澡搓破痣竟成癌","value":4967,"itemStyle":{"normal":{"color":"#da70d6"}}},{"name":"小燕子替身是男生","value":7852,"itemStyle":{"normal":{"color":"#87cefa"}}},{"name":"徐静蕾冻卵会上瘾","value":15678,"itemStyle":{"normal":{"color":"#87cefa"}}},{"name":"姚明代言成被告","value":12500,"itemStyle":{"normal":{"color":"#87cefa"}}},{"name":"英国出现新毒品","value":8683,"itemStyle":{"normal":{"color":"#87cefa"}}},{"name":"又一个小杨幂出道","value":67011,"itemStyle":{"normal":{"color":"#da70d6"}}},{"name":"醉酒撞停放车身亡","value":35571,"itemStyle":{"normal":{"color":"#da70d6"}}},{"name":"mobileye被收购","value":5464,"itemStyle":{"normal":{"color":"#da70d6"}}}],"textRotation":[0,-45,45,90],"type":"wordCloud","size":["80%","80%"]}],"legend":{"show":true,"data":[],"x":"left","y":"top","orient":"horizontal"},"xAxis":[{"type":"category","show":false,"position":"bottom","name":"","nameLocation":"end","boundaryGap":[0,0],"scale":true,"axisLine":{"show":true,"onZero":false},"axisTick":{"show":false},"axisLabel":{"show":true},"splitLine":{"show":true},"splitArea":{"show":false},"data":["道路最牛钉子树","母亲女儿同怀二胎","沈梦辰揭澡戏内幕","吃牛排长五米虫子","又一个小杨幂出道","刘诗诗推助理行李","不老男神费翔发福","醉酒撞停放车身亡","男星载女友遇车祸","联合打击瘦脸针","记者暗访外卖餐馆","王宝强称做人忠诚","母亲怒砸玛莎拉蒂","徐静蕾冻卵会上瘾","马云进军美遇对手","姚明代言成被告","刘涛十年前照曝光","情书有求婚藏头诗","英国出现新毒品","倪萍感谢苦难","小燕子替身是男生","曝俏江南黑厨内幕","男子购买陨石求婚","李小璐喊话曹云金","赌王儿子坐经济舱","刀砍老师后被群殴","mobileye被收购","扩建鱼塘挖出古墓","洗澡搓破痣竟成癌","范冰冰半夜看剧本"]}],"yAxis":[{"type":"value","show":false,"position":"left","name":"","nameLocation":"end","boundaryGap":[0,0],"scale":true,"axisLine":{"show":true,"onZero":false},"axisTick":{"show":false},"axisLabel":{"show":true},"splitLine":{"show":true},"splitArea":{"show":false}}],"grid":{"borderWidth":0},"tooltip":{"show":true,"trigger":"axis","axisPointer":{"type":"none","crossStyle":{"type":"dashed"},"lineStyle":{"type":"solid","width":1},"shadowStyle":{"color":"rgba(150,150,150,0.3)","width":"auto","type":"default"}},"textStyle":{"color":"#fff"},"islandFormatter":"{a} < br/>{b} : {c}","enterable":false,"showDelay":20,"hideDelay":100,"transitionDuration":0.4,"backgroundColor":"rgba(0,0,0,0.7)","borderColor":"#333","borderWidth":0,"borderRadius":4},"toolbox":{"show":true,"feature":{"mark":{"show":true},"dataZoom":{"show":true},"dataView":{"show":true,"readOnly":false},"magicType":{"show":false},"restore":{"show":true},"saveAsImage":{"show":true}},"x":"right","y":"top","orient":"horizontal"},"title":{"text":"Baidu Hot Word Top30 (realtime)","subtext":"2017-03-15 23:54:15","x":"center","y":"bottom","orient":"horizontal"}},"evals":[],"jsHooks":[]}</script>
</div>
<div id="with-timeline" class="section level2">
<h2><span class="header-section-number">3.4</span> With Timeline</h2>
<p>Let’s compare realtime, today, and 7-days hotwords.</p>
<p>First, get the other two web pages and rbind the datasets.</p>
<div class="sourceCode"><pre class="sourceCode r"><code class="sourceCode r">hotword$t &lt;-<span class="st"> &#39;Realtime&#39;</span>
hotword1 &lt;-<span class="st"> </span><span class="kw">getBaiduHot</span>(<span class="st">&quot;http://top.baidu.com/buzz?b=341&amp;fr=topbuzz_b1&quot;</span>)
hotword1$t &lt;-<span class="st"> &#39;Today&#39;</span>
hotword2 &lt;-<span class="st"> </span><span class="kw">getBaiduHot</span>(<span class="st">&quot;http://top.baidu.com/buzz?b=42&amp;c=513&amp;fr=topbuzz_b341&quot;</span>)</code></pre></div>
<pre><code>## Warning in stri_conv(string, encoding, &quot;UTF-8&quot;): input data \xfffffff9 in
## current source encoding could not be converted to Unicode</code></pre>
<div class="sourceCode"><pre class="sourceCode r"><code class="sourceCode r">hotword2$t &lt;-<span class="st"> &#39;7-days&#39;</span>
hotword &lt;-<span class="st"> </span><span class="kw">do.call</span>(<span class="st">&#39;rbind&#39;</span>, <span class="kw">list</span>(hotword, hotword1, hotword2))
hotword$t &lt;-<span class="st"> </span><span class="kw">factor</span>(hotword$t, <span class="dt">levels=</span><span class="kw">c</span>(<span class="st">&#39;Realtime&#39;</span>, <span class="st">&#39;Today&#39;</span>, <span class="st">&#39;7-days&#39;</span>))</code></pre></div>
<p>Then come up with the chart.</p>
<div class="sourceCode"><pre class="sourceCode r"><code class="sourceCode r">g &lt;-<span class="st"> </span><span class="kw">echartr</span>(hotword, Keyword, Freq, <span class="dt">t=</span>t, <span class="dt">type=</span><span class="st">&#39;wordCloud&#39;</span>) %&gt;%<span class="st"> </span>
<span class="st">    </span><span class="kw">setTitle</span>(<span class="st">&#39;Baidu Hot Word Top30&#39;</span>)
g</code></pre></div>
<div id="htmlwidget-343861fcfbdeeb1e0cc2" style="width:672px;height:480px;" class="echarts html-widget"></div>
<script type="application/json" data-for="htmlwidget-343861fcfbdeeb1e0cc2">{"x":{"timeline":{"type":"number","data":["Realtime","Today","7-days"],"x":80,"x2":80,"y2":50},"options":[{"series":[{"data":[{"name":"不老男神费翔发福","value":41493,"itemStyle":{"normal":{"color":"#cd5c5c"}}},{"name":"沈梦辰揭澡戏内幕","value":105433,"itemStyle":{"normal":{"color":"#1e90ff"}}},{"name":"吃牛排长五米虫子","value":102738,"itemStyle":{"normal":{"color":"#00fa9a"}}},{"name":"刀砍老师后被群殴","value":5732,"itemStyle":{"normal":{"color":"#1e90ff"}}},{"name":"道路最牛钉子树","value":411727,"itemStyle":{"normal":{"color":"#ff69b4"}}},{"name":"赌王儿子坐经济舱","value":6274,"itemStyle":{"normal":{"color":"#ff7f50"}}},{"name":"范冰冰半夜看剧本","value":4661,"itemStyle":{"normal":{"color":"#ff7f50"}}},{"name":"记者暗访外卖餐馆","value":22341,"itemStyle":{"normal":{"color":"#3cb371"}}},{"name":"扩建鱼塘挖出古墓","value":5170,"itemStyle":{"normal":{"color":"#ff00ff"}}},{"name":"李小璐喊话曹云金","value":6739,"itemStyle":{"normal":{"color":"#da70d6"}}},{"name":"联合打击瘦脸针","value":26150,"itemStyle":{"normal":{"color":"#30e0e0"}}},{"name":"刘诗诗推助理行李","value":43648,"itemStyle":{"normal":{"color":"#cd5c5c"}}},{"name":"刘涛十年前照曝光","value":10862,"itemStyle":{"normal":{"color":"#40e0d0"}}},{"name":"马云进军美遇对手","value":15534,"itemStyle":{"normal":{"color":"#1e90ff"}}},{"name":"母亲怒砸玛莎拉蒂","value":16104,"itemStyle":{"normal":{"color":"#30e0e0"}}},{"name":"母亲女儿同怀二胎","value":267299,"itemStyle":{"normal":{"color":"#6495ed"}}},{"name":"男星载女友遇车祸","value":29343,"itemStyle":{"normal":{"color":"#00fa9a"}}},{"name":"男子购买陨石求婚","value":6979,"itemStyle":{"normal":{"color":"#da70d6"}}},{"name":"倪萍感谢苦难","value":7982,"itemStyle":{"normal":{"color":"#ffd700"}}},{"name":"曝俏江南黑厨内幕","value":7296,"itemStyle":{"normal":{"color":"#7b68ee"}}},{"name":"情书有求婚藏头诗","value":8830,"itemStyle":{"normal":{"color":"#32cd32"}}},{"name":"王宝强称做人忠诚","value":17171,"itemStyle":{"normal":{"color":"#40e0d0"}}},{"name":"洗澡搓破痣竟成癌","value":4967,"itemStyle":{"normal":{"color":"#1e90ff"}}},{"name":"小燕子替身是男生","value":7852,"itemStyle":{"normal":{"color":"#6495ed"}}},{"name":"徐静蕾冻卵会上瘾","value":15678,"itemStyle":{"normal":{"color":"#00fa9a"}}},{"name":"姚明代言成被告","value":12500,"itemStyle":{"normal":{"color":"#ff7f50"}}},{"name":"英国出现新毒品","value":8683,"itemStyle":{"normal":{"color":"#ffa500"}}},{"name":"又一个小杨幂出道","value":67011,"itemStyle":{"normal":{"color":"#00fa9a"}}},{"name":"醉酒撞停放车身亡","value":35571,"itemStyle":{"normal":{"color":"#ffa500"}}},{"name":"mobileye被收购","value":5464,"itemStyle":{"normal":{"color":"#ff6347"}}}],"textRotation":[0,-45,-90,45,90],"type":"wordCloud","size":["80%","80%"]}],"xAxis":[{"type":"category","show":false,"position":"bottom","name":"","nameLocation":"end","boundaryGap":[0,0],"scale":true,"axisLine":{"show":true,"onZero":false},"axisTick":{"show":false},"axisLabel":{"show":true},"splitLine":{"show":true},"splitArea":{"show":false},"data":["道路最牛钉子树","母亲女儿同怀二胎","沈梦辰揭澡戏内幕","吃牛排长五米虫子","又一个小杨幂出道","刘诗诗推助理行李","不老男神费翔发福","醉酒撞停放车身亡","男星载女友遇车祸","联合打击瘦脸针","记者暗访外卖餐馆","王宝强称做人忠诚","母亲怒砸玛莎拉蒂","徐静蕾冻卵会上瘾","马云进军美遇对手","姚明代言成被告","刘涛十年前照曝光","情书有求婚藏头诗","英国出现新毒品","倪萍感谢苦难","小燕子替身是男生","曝俏江南黑厨内幕","男子购买陨石求婚","李小璐喊话曹云金","赌王儿子坐经济舱","刀砍老师后被群殴","mobileye被收购","扩建鱼塘挖出古墓","洗澡搓破痣竟成癌","范冰冰半夜看剧本","劝领导别插队被开","陈冠希近照公开","万斤病死猪肉卖出","因妻生娃解散公司","霍金再发警告","女孩白游17国","向往的生活","快递员被逼磕头","摔断手镯索赔8万","陈道明再讽小鲜肉","国美索赔4900万","德企拒下辱华t恤","男子击败全国脑型","孙俪录音唤醒铁粉","赵薇被强摘眼镜","范冰冰晒睡美人照","全球最大深海巨兽","女学生骑死飞坠崖","娃独自下车被牵走","全国企业信用信息公示系统","打电话让民警当托","琼瑶交代身后事","点地雷菜被炸伤","半夜开水泼醒丈夫","村医烧掉病人欠条","谢娜将离开快本","两会现女神翻译","美国自由女神灯灭","郑爽晒黑卡被批","大二学生上吊身亡","快女冠军变猛男","宋辞捌扪罨鄯⑸","已婚男交119女友","朝鲜导弹掉落日本","越南三生三世曝光","蒋劲夫被路人买单","婴儿盖40万睡","曝周杰伦空中豪宅","2分钟生完娃离开","李宗瑞获刑39年","小学性教育书脱销","王思聪夜场劲嗨","陈赫晒张子萱照片","爱情公寓八年重聚","斯嘉丽约翰逊离婚","55岁庾澄庆当爸","李宗瑞被判39年","朴槿惠被弹劾下台"]}],"yAxis":[{"type":"value","show":false,"position":"left","name":"","nameLocation":"end","boundaryGap":[0,0],"scale":true,"axisLine":{"show":true,"onZero":false},"axisTick":{"show":false},"axisLabel":{"show":true},"splitLine":{"show":true},"splitArea":{"show":false}}],"grid":{"borderWidth":0},"tooltip":{"show":true,"trigger":"axis","axisPointer":{"type":"none","crossStyle":{"type":"dashed"},"lineStyle":{"type":"solid","width":1},"shadowStyle":{"color":"rgba(150,150,150,0.3)","width":"auto","type":"default"}},"textStyle":{"color":"#fff"},"islandFormatter":"{a} < br/>{b} : {c}","enterable":false,"showDelay":20,"hideDelay":100,"transitionDuration":0.4,"backgroundColor":"rgba(0,0,0,0.7)","borderColor":"#333","borderWidth":0,"borderRadius":4},"toolbox":{"show":true,"feature":{"mark":{"show":true},"dataZoom":{"show":true},"dataView":{"show":true,"readOnly":false},"magicType":{"show":false},"restore":{"show":true},"saveAsImage":{"show":true}},"x":"right","y":"top","orient":"horizontal"},"legend":{"show":true,"data":[],"x":"left","y":"top","orient":"horizontal"},"title":{"text":"Baidu Hot Word Top30 (t: Realtime)","x":"center","y":"bottom","orient":"horizontal"}},{"series":[{"data":[{"name":"半夜开水泼醒丈夫","value":30588,"itemStyle":{"normal":{"color":"#ff6347"}}},{"name":"陈道明再讽小鲜肉","value":81614,"itemStyle":{"normal":{"color":"#b8860b"}}},{"name":"陈冠希近照公开","value":171167,"itemStyle":{"normal":{"color":"#cd5c5c"}}},{"name":"村医烧掉病人欠条","value":30414,"itemStyle":{"normal":{"color":"#6b8e23"}}},{"name":"打电话让民警当托","value":35280,"itemStyle":{"normal":{"color":"#ba55d3"}}},{"name":"刀砍老师后被群殴","value":104108,"itemStyle":{"normal":{"color":"#40e0d0"}}},{"name":"德企拒下辱华t恤","value":69067,"itemStyle":{"normal":{"color":"#40e0d0"}}},{"name":"点地雷菜被炸伤","value":31592,"itemStyle":{"normal":{"color":"#1e90ff"}}},{"name":"范冰冰晒睡美人照","value":43316,"itemStyle":{"normal":{"color":"#32cd32"}}},{"name":"国美索赔4900万","value":69401,"itemStyle":{"normal":{"color":"#32cd32"}}},{"name":"霍金再发警告","value":115281,"itemStyle":{"normal":{"color":"#da70d6"}}},{"name":"快递员被逼磕头","value":90837,"itemStyle":{"normal":{"color":"#1e90ff"}}},{"name":"李小璐喊话曹云金","value":200900,"itemStyle":{"normal":{"color":"#6495ed"}}},{"name":"母亲怒砸玛莎拉蒂","value":239361,"itemStyle":{"normal":{"color":"#1e90ff"}}},{"name":"男子击败全国脑型","value":64292,"itemStyle":{"normal":{"color":"#ba55d3"}}},{"name":"女孩白游17国","value":115020,"itemStyle":{"normal":{"color":"#6b8e23"}}},{"name":"女学生骑死飞坠崖","value":40859,"itemStyle":{"normal":{"color":"#32cd32"}}},{"name":"曝俏江南黑厨内幕","value":126243,"itemStyle":{"normal":{"color":"#b8860b"}}},{"name":"琼瑶交代身后事","value":32498,"itemStyle":{"normal":{"color":"#7b68ee"}}},{"name":"全国企业信用信息公示系统","value":35543,"itemStyle":{"normal":{"color":"#ff7f50"}}},{"name":"全球最大深海巨兽","value":40954,"itemStyle":{"normal":{"color":"#00fa9a"}}},{"name":"劝领导别插队被开","value":299535,"itemStyle":{"normal":{"color":"#cd5c5c"}}},{"name":"摔断手镯索赔8万","value":82231,"itemStyle":{"normal":{"color":"#30e0e0"}}},{"name":"孙俪录音唤醒铁粉","value":54059,"itemStyle":{"normal":{"color":"#da70d6"}}},{"name":"娃独自下车被牵走","value":37126,"itemStyle":{"normal":{"color":"#ba55d3"}}},{"name":"万斤病死猪肉卖出","value":130826,"itemStyle":{"normal":{"color":"#ffa500"}}},{"name":"洗澡搓破痣竟成癌","value":72664,"itemStyle":{"normal":{"color":"#30e0e0"}}},{"name":"向往的生活","value":98140,"itemStyle":{"normal":{"color":"#6495ed"}}},{"name":"因妻生娃解散公司","value":115848,"itemStyle":{"normal":{"color":"#6495ed"}}},{"name":"赵薇被强摘眼镜","value":47427,"itemStyle":{"normal":{"color":"#00fa9a"}}}],"textRotation":[0,-45,-90,45,90],"type":"wordCloud","size":["80%","80%"]}],"title":{"text":"Baidu Hot Word Top30 (t: Today)","x":"center","y":"bottom","orient":"horizontal"}},{"series":[{"data":[{"name":"2分钟生完娃离开","value":281736,"itemStyle":{"normal":{"color":"#1e90ff"}}},{"name":"55岁庾澄庆当爸","value":222656,"itemStyle":{"normal":{"color":"#ffd700"}}},{"name":"爱情公寓八年重聚","value":235745,"itemStyle":{"normal":{"color":"#30e0e0"}}},{"name":"半夜开水泼醒丈夫","value":296546,"itemStyle":{"normal":{"color":"#6495ed"}}},{"name":"朝鲜导弹掉落日本","value":348254,"itemStyle":{"normal":{"color":"#ffd700"}}},{"name":"陈赫晒张子萱照片","value":241366,"itemStyle":{"normal":{"color":"#ff69b4"}}},{"name":"大二学生上吊身亡","value":437336,"itemStyle":{"normal":{"color":"#ba55d3"}}},{"name":"德企拒下辱华t恤","value":233380,"itemStyle":{"normal":{"color":"#6495ed"}}},{"name":"蒋劲夫被路人买单","value":317076,"itemStyle":{"normal":{"color":"#ff69b4"}}},{"name":"快女冠军变猛男","value":426422,"itemStyle":{"normal":{"color":"#ffd700"}}},{"name":"李宗瑞被判39年","value":222599,"itemStyle":{"normal":{"color":"#6495ed"}}},{"name":"李宗瑞获刑39年","value":279130,"itemStyle":{"normal":{"color":"#cd5c5c"}}},{"name":"两会现女神翻译","value":502199,"itemStyle":{"normal":{"color":"#ff69b4"}}},{"name":"美国自由女神灯灭","value":482817,"itemStyle":{"normal":{"color":"#6b8e23"}}},{"name":"母亲怒砸玛莎拉蒂","value":239361,"itemStyle":{"normal":{"color":"#6b8e23"}}},{"name":"女学生骑死飞坠崖","value":347480,"itemStyle":{"normal":{"color":"#32cd32"}}},{"name":"朴槿惠被弹劾下台","value":218042,"itemStyle":{"normal":{"color":"#da70d6"}}},{"name":"曝周杰伦空中豪宅","value":287215,"itemStyle":{"normal":{"color":"#32cd32"}}},{"name":"全球最大深海巨兽","value":486476,"itemStyle":{"normal":{"color":"#ff7f50"}}},{"name":"劝领导别插队被开","value":357702,"itemStyle":{"normal":{"color":"#cd5c5c"}}},{"name":"斯嘉丽约翰逊离婚","value":227191,"itemStyle":{"normal":{"color":"#ff7f50"}}},{"name":"宋辞捌扪罨鄯⑸","value":417789,"itemStyle":{"normal":{"color":"#ff69b4"}}},{"name":"王思聪夜场劲嗨","value":248664,"itemStyle":{"normal":{"color":"#6b8e23"}}},{"name":"小学性教育书脱销","value":265996,"itemStyle":{"normal":{"color":"#cd5c5c"}}},{"name":"谢娜将离开快本","value":707251,"itemStyle":{"normal":{"color":"#ff00ff"}}},{"name":"已婚男交119女友","value":397293,"itemStyle":{"normal":{"color":"#ff69b4"}}},{"name":"婴儿盖40万睡","value":293228,"itemStyle":{"normal":{"color":"#7b68ee"}}},{"name":"越南三生三世曝光","value":331325,"itemStyle":{"normal":{"color":"#ffd700"}}},{"name":"赵薇被强摘眼镜","value":513451,"itemStyle":{"normal":{"color":"#7b68ee"}}},{"name":"郑爽晒黑卡被批","value":465043,"itemStyle":{"normal":{"color":"#32cd32"}}}],"textRotation":[0,-45,-90,45,90],"type":"wordCloud","size":["80%","80%"]}],"title":{"text":"Baidu Hot Word Top30 (t: 7-days)","x":"center","y":"bottom","orient":"horizontal"}}]},"evals":[],"jsHooks":[]}</script>
</div>
</div>
<div id="futher-setup" class="section level1">
<h1><span class="header-section-number">4</span> Futher Setup</h1>
<p>Then you can configure the widgets, add markLines and/or markPoints, fortify the chart.</p>
<div id="settheme" class="section level2">
<h2><span class="header-section-number">4.1</span> <code>setTheme</code></h2>
<div class="sourceCode"><pre class="sourceCode r"><code class="sourceCode r">g %&gt;%<span class="st"> </span><span class="kw">setTheme</span>(<span class="st">&#39;dark&#39;</span>, <span class="dt">palette=</span><span class="st">&#39;manyeyes&#39;</span>)</code></pre></div>
<div id="htmlwidget-48730b6fd5902ff45907" style="width:672px;height:480px;" class="echarts html-widget"></div>
<script type="application/json" data-for="htmlwidget-48730b6fd5902ff45907">{"x":{"timeline":{"type":"number","data":["Realtime","Today","7-days"],"x":80,"x2":80,"y2":50},"options":[{"series":[{"data":[{"name":"不老男神费翔发福","value":41493,"itemStyle":{"normal":{"color":"#843c39"}}},{"name":"沈梦辰揭澡戏内幕","value":105433,"itemStyle":{"normal":{"color":"#de9ed6"}}},{"name":"吃牛排长五米虫子","value":102738,"itemStyle":{"normal":{"color":"#4a5584"}}},{"name":"刀砍老师后被群殴","value":5732,"itemStyle":{"normal":{"color":"#637939"}}},{"name":"道路最牛钉子树","value":411727,"itemStyle":{"normal":{"color":"#b5cf6b"}}},{"name":"赌王儿子坐经济舱","value":6274,"itemStyle":{"normal":{"color":"#ad494a"}}},{"name":"范冰冰半夜看剧本","value":4661,"itemStyle":{"normal":{"color":"#7b4173"}}},{"name":"记者暗访外卖餐馆","value":22341,"itemStyle":{"normal":{"color":"#843c39"}}},{"name":"扩建鱼塘挖出古墓","value":5170,"itemStyle":{"normal":{"color":"#bd9e39"}}},{"name":"李小璐喊话曹云金","value":6739,"itemStyle":{"normal":{"color":"#a55194"}}},{"name":"联合打击瘦脸针","value":26150,"itemStyle":{"normal":{"color":"#ce6dbd"}}},{"name":"刘诗诗推助理行李","value":43648,"itemStyle":{"normal":{"color":"#e7cb94"}}},{"name":"刘涛十年前照曝光","value":10862,"itemStyle":{"normal":{"color":"#7375b5"}}},{"name":"马云进军美遇对手","value":15534,"itemStyle":{"normal":{"color":"#9c9ede"}}},{"name":"母亲怒砸玛莎拉蒂","value":16104,"itemStyle":{"normal":{"color":"#4a5584"}}},{"name":"母亲女儿同怀二胎","value":267299,"itemStyle":{"normal":{"color":"#8ca252"}}},{"name":"男星载女友遇车祸","value":29343,"itemStyle":{"normal":{"color":"#d6616b"}}},{"name":"男子购买陨石求婚","value":6979,"itemStyle":{"normal":{"color":"#e7969c"}}},{"name":"倪萍感谢苦难","value":7982,"itemStyle":{"normal":{"color":"#7b4173"}}},{"name":"曝俏江南黑厨内幕","value":7296,"itemStyle":{"normal":{"color":"#ad494a"}}},{"name":"情书有求婚藏头诗","value":8830,"itemStyle":{"normal":{"color":"#e7969c"}}},{"name":"王宝强称做人忠诚","value":17171,"itemStyle":{"normal":{"color":"#9c9ede"}}},{"name":"洗澡搓破痣竟成癌","value":4967,"itemStyle":{"normal":{"color":"#b5cf6b"}}},{"name":"小燕子替身是男生","value":7852,"itemStyle":{"normal":{"color":"#e7cb94"}}},{"name":"徐静蕾冻卵会上瘾","value":15678,"itemStyle":{"normal":{"color":"#637939"}}},{"name":"姚明代言成被告","value":12500,"itemStyle":{"normal":{"color":"#7b4173"}}},{"name":"英国出现新毒品","value":8683,"itemStyle":{"normal":{"color":"#e7ba52"}}},{"name":"又一个小杨幂出道","value":67011,"itemStyle":{"normal":{"color":"#e7ba52"}}},{"name":"醉酒撞停放车身亡","value":35571,"itemStyle":{"normal":{"color":"#e7cb94"}}},{"name":"mobileye被收购","value":5464,"itemStyle":{"normal":{"color":"#bd9e39"}}}],"textRotation":[0,-45,-90,45,90],"type":"wordCloud","size":["80%","80%"]}],"xAxis":[{"type":"category","show":false,"position":"bottom","name":"","nameLocation":"end","boundaryGap":[0,0],"scale":true,"axisLine":{"show":true,"onZero":false},"axisTick":{"show":false},"axisLabel":{"show":true},"splitLine":{"show":true},"splitArea":{"show":false},"data":["道路最牛钉子树","母亲女儿同怀二胎","沈梦辰揭澡戏内幕","吃牛排长五米虫子","又一个小杨幂出道","刘诗诗推助理行李","不老男神费翔发福","醉酒撞停放车身亡","男星载女友遇车祸","联合打击瘦脸针","记者暗访外卖餐馆","王宝强称做人忠诚","母亲怒砸玛莎拉蒂","徐静蕾冻卵会上瘾","马云进军美遇对手","姚明代言成被告","刘涛十年前照曝光","情书有求婚藏头诗","英国出现新毒品","倪萍感谢苦难","小燕子替身是男生","曝俏江南黑厨内幕","男子购买陨石求婚","李小璐喊话曹云金","赌王儿子坐经济舱","刀砍老师后被群殴","mobileye被收购","扩建鱼塘挖出古墓","洗澡搓破痣竟成癌","范冰冰半夜看剧本","劝领导别插队被开","陈冠希近照公开","万斤病死猪肉卖出","因妻生娃解散公司","霍金再发警告","女孩白游17国","向往的生活","快递员被逼磕头","摔断手镯索赔8万","陈道明再讽小鲜肉","国美索赔4900万","德企拒下辱华t恤","男子击败全国脑型","孙俪录音唤醒铁粉","赵薇被强摘眼镜","范冰冰晒睡美人照","全球最大深海巨兽","女学生骑死飞坠崖","娃独自下车被牵走","全国企业信用信息公示系统","打电话让民警当托","琼瑶交代身后事","点地雷菜被炸伤","半夜开水泼醒丈夫","村医烧掉病人欠条","谢娜将离开快本","两会现女神翻译","美国自由女神灯灭","郑爽晒黑卡被批","大二学生上吊身亡","快女冠军变猛男","宋辞捌扪罨鄯⑸","已婚男交119女友","朝鲜导弹掉落日本","越南三生三世曝光","蒋劲夫被路人买单","婴儿盖40万睡","曝周杰伦空中豪宅","2分钟生完娃离开","李宗瑞获刑39年","小学性教育书脱销","王思聪夜场劲嗨","陈赫晒张子萱照片","爱情公寓八年重聚","斯嘉丽约翰逊离婚","55岁庾澄庆当爸","李宗瑞被判39年","朴槿惠被弹劾下台"]}],"yAxis":[{"type":"value","show":false,"position":"left","name":"","nameLocation":"end","boundaryGap":[0,0],"scale":true,"axisLine":{"show":true,"onZero":false},"axisTick":{"show":false},"axisLabel":{"show":true},"splitLine":{"show":true},"splitArea":{"show":false}}],"grid":{"borderWidth":0},"tooltip":{"show":true,"trigger":"axis","axisPointer":{"type":"none","crossStyle":{"type":"dashed"},"lineStyle":{"type":"solid","width":1},"shadowStyle":{"color":"rgba(150,150,150,0.3)","width":"auto","type":"default"}},"textStyle":{"color":"#fff"},"islandFormatter":"{a} < br/>{b} : {c}","enterable":false,"showDelay":20,"hideDelay":100,"transitionDuration":0.4,"backgroundColor":"rgba(0,0,0,0.7)","borderColor":"#333","borderWidth":0,"borderRadius":4},"toolbox":{"show":true,"feature":{"mark":{"show":true},"dataZoom":{"show":true},"dataView":{"show":true,"readOnly":false},"magicType":{"show":false},"restore":{"show":true},"saveAsImage":{"show":true}},"x":"right","y":"top","orient":"horizontal"},"legend":{"show":true,"data":[],"x":"left","y":"top","orient":"horizontal"},"title":{"text":"Baidu Hot Word Top30 (t: Realtime)","x":"center","y":"bottom","orient":"horizontal"},"color":["#9c9ede"]},{"series":[{"data":[{"name":"半夜开水泼醒丈夫","value":30588,"itemStyle":{"normal":{"color":"#bd9e39"}}},{"name":"陈道明再讽小鲜肉","value":81614,"itemStyle":{"normal":{"color":"#843c39"}}},{"name":"陈冠希近照公开","value":171167,"itemStyle":{"normal":{"color":"#ce6dbd"}}},{"name":"村医烧掉病人欠条","value":30414,"itemStyle":{"normal":{"color":"#e7ba52"}}},{"name":"打电话让民警当托","value":35280,"itemStyle":{"normal":{"color":"#e7cb94"}}},{"name":"刀砍老师后被群殴","value":104108,"itemStyle":{"normal":{"color":"#a55194"}}},{"name":"德企拒下辱华t恤","value":69067,"itemStyle":{"normal":{"color":"#843c39"}}},{"name":"点地雷菜被炸伤","value":31592,"itemStyle":{"normal":{"color":"#de9ed6"}}},{"name":"范冰冰晒睡美人照","value":43316,"itemStyle":{"normal":{"color":"#637939"}}},{"name":"国美索赔4900万","value":69401,"itemStyle":{"normal":{"color":"#9c9ede"}}},{"name":"霍金再发警告","value":115281,"itemStyle":{"normal":{"color":"#de9ed6"}}},{"name":"快递员被逼磕头","value":90837,"itemStyle":{"normal":{"color":"#e7ba52"}}},{"name":"李小璐喊话曹云金","value":200900,"itemStyle":{"normal":{"color":"#ce6dbd"}}},{"name":"母亲怒砸玛莎拉蒂","value":239361,"itemStyle":{"normal":{"color":"#b5cf6b"}}},{"name":"男子击败全国脑型","value":64292,"itemStyle":{"normal":{"color":"#7b4173"}}},{"name":"女孩白游17国","value":115020,"itemStyle":{"normal":{"color":"#8c6d31"}}},{"name":"女学生骑死飞坠崖","value":40859,"itemStyle":{"normal":{"color":"#a55194"}}},{"name":"曝俏江南黑厨内幕","value":126243,"itemStyle":{"normal":{"color":"#843c39"}}},{"name":"琼瑶交代身后事","value":32498,"itemStyle":{"normal":{"color":"#4a5584"}}},{"name":"全国企业信用信息公示系统","value":35543,"itemStyle":{"normal":{"color":"#cedb9c"}}},{"name":"全球最大深海巨兽","value":40954,"itemStyle":{"normal":{"color":"#de9ed6"}}},{"name":"劝领导别插队被开","value":299535,"itemStyle":{"normal":{"color":"#e7ba52"}}},{"name":"摔断手镯索赔8万","value":82231,"itemStyle":{"normal":{"color":"#ce6dbd"}}},{"name":"孙俪录音唤醒铁粉","value":54059,"itemStyle":{"normal":{"color":"#bd9e39"}}},{"name":"娃独自下车被牵走","value":37126,"itemStyle":{"normal":{"color":"#ce6dbd"}}},{"name":"万斤病死猪肉卖出","value":130826,"itemStyle":{"normal":{"color":"#cedb9c"}}},{"name":"洗澡搓破痣竟成癌","value":72664,"itemStyle":{"normal":{"color":"#de9ed6"}}},{"name":"向往的生活","value":98140,"itemStyle":{"normal":{"color":"#843c39"}}},{"name":"因妻生娃解散公司","value":115848,"itemStyle":{"normal":{"color":"#ad494a"}}},{"name":"赵薇被强摘眼镜","value":47427,"itemStyle":{"normal":{"color":"#8c6d31"}}}],"textRotation":[0,-45,-90,45,90],"type":"wordCloud","size":["80%","80%"]}],"title":{"text":"Baidu Hot Word Top30 (t: Today)","x":"center","y":"bottom","orient":"horizontal"}},{"series":[{"data":[{"name":"2分钟生完娃离开","value":281736,"itemStyle":{"normal":{"color":"#cedb9c"}}},{"name":"55岁庾澄庆当爸","value":222656,"itemStyle":{"normal":{"color":"#8ca252"}}},{"name":"爱情公寓八年重聚","value":235745,"itemStyle":{"normal":{"color":"#4a5584"}}},{"name":"半夜开水泼醒丈夫","value":296546,"itemStyle":{"normal":{"color":"#e7ba52"}}},{"name":"朝鲜导弹掉落日本","value":348254,"itemStyle":{"normal":{"color":"#637939"}}},{"name":"陈赫晒张子萱照片","value":241366,"itemStyle":{"normal":{"color":"#bd9e39"}}},{"name":"大二学生上吊身亡","value":437336,"itemStyle":{"normal":{"color":"#de9ed6"}}},{"name":"德企拒下辱华t恤","value":233380,"itemStyle":{"normal":{"color":"#637939"}}},{"name":"蒋劲夫被路人买单","value":317076,"itemStyle":{"normal":{"color":"#de9ed6"}}},{"name":"快女冠军变猛男","value":426422,"itemStyle":{"normal":{"color":"#ce6dbd"}}},{"name":"李宗瑞被判39年","value":222599,"itemStyle":{"normal":{"color":"#e7cb94"}}},{"name":"李宗瑞获刑39年","value":279130,"itemStyle":{"normal":{"color":"#ce6dbd"}}},{"name":"两会现女神翻译","value":502199,"itemStyle":{"normal":{"color":"#4a5584"}}},{"name":"美国自由女神灯灭","value":482817,"itemStyle":{"normal":{"color":"#637939"}}},{"name":"母亲怒砸玛莎拉蒂","value":239361,"itemStyle":{"normal":{"color":"#e7969c"}}},{"name":"女学生骑死飞坠崖","value":347480,"itemStyle":{"normal":{"color":"#bd9e39"}}},{"name":"朴槿惠被弹劾下台","value":218042,"itemStyle":{"normal":{"color":"#cedb9c"}}},{"name":"曝周杰伦空中豪宅","value":287215,"itemStyle":{"normal":{"color":"#7375b5"}}},{"name":"全球最大深海巨兽","value":486476,"itemStyle":{"normal":{"color":"#e7cb94"}}},{"name":"劝领导别插队被开","value":357702,"itemStyle":{"normal":{"color":"#8ca252"}}},{"name":"斯嘉丽约翰逊离婚","value":227191,"itemStyle":{"normal":{"color":"#ce6dbd"}}},{"name":"宋辞捌扪罨鄯⑸","value":417789,"itemStyle":{"normal":{"color":"#e7ba52"}}},{"name":"王思聪夜场劲嗨","value":248664,"itemStyle":{"normal":{"color":"#cedb9c"}}},{"name":"小学性教育书脱销","value":265996,"itemStyle":{"normal":{"color":"#7b4173"}}},{"name":"谢娜将离开快本","value":707251,"itemStyle":{"normal":{"color":"#8c6d31"}}},{"name":"已婚男交119女友","value":397293,"itemStyle":{"normal":{"color":"#843c39"}}},{"name":"婴儿盖40万睡","value":293228,"itemStyle":{"normal":{"color":"#e7969c"}}},{"name":"越南三生三世曝光","value":331325,"itemStyle":{"normal":{"color":"#9c9ede"}}},{"name":"赵薇被强摘眼镜","value":513451,"itemStyle":{"normal":{"color":"#7375b5"}}},{"name":"郑爽晒黑卡被批","value":465043,"itemStyle":{"normal":{"color":"#d6616b"}}}],"textRotation":[0,-45,-90,45,90],"type":"wordCloud","size":["80%","80%"]}],"title":{"text":"Baidu Hot Word Top30 (t: 7-days)","x":"center","y":"bottom","orient":"horizontal"}}],"theme":"dark"},"evals":[],"jsHooks":[]}</script>
<p>You can refer to related functions to play around on your own.</p>
</div>
</div>

<script type="text/javascript">
window.onload = function() {
  var i, fig = 1, caps = document.getElementsByClassName('caption');
  for (i = 0; i < caps.length; i++) {
    var cap = caps[i];
    if (cap.parentElement.className !== 'figure' || cap.nodeName !== 'P')
      continue;
    cap.innerHTML = '<span>Figure ' + fig + ':</span> ' + cap.innerHTML;
    fig++;
  }
  fig = 1;
  caps = document.getElementsByTagName('caption');
  for (i = 0; i < caps.length; i++) {
    var cap = caps[i];
    if (cap.parentElement.nodeName !== 'TABLE') continue;
    cap.innerHTML = '<span>Table ' + fig + ':</span> ' + cap.innerHTML;
    fig++;
  }
}
</script>



</div>

<script>

// add bootstrap table styles to pandoc tables
function bootstrapStylePandocTables() {
  $('tr.header').parent('thead').parent('table').addClass('table table-condensed');
}
$(document).ready(function () {
  bootstrapStylePandocTables();
});


</script>

<!-- dynamically load mathjax for compatibility with self-contained -->
<script>
  (function () {
    var script = document.createElement("script");
    script.type = "text/javascript";
    script.src  = "https://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-AMS-MML_HTMLorMML";
    document.getElementsByTagName("head")[0].appendChild(script);
  })();
</script>

</body>
</html>
